<?php
namespace util;

class PasswordHash {

    public static function check($encPass, $cPass, $salt){
        $real_pwd = PasswordHash::encrypt_password($cPass, $salt);

        return $real_pwd == $encPass;
    }

    /**
     * @param $password
     * @param $salt
     * @return bool|string
     */
    public static function encrypt_password($password, $salt = '') {
        return md5($password . md5($salt));
    }

    public static function createSalt($username) {
        return md5($username);
    }
}